<template>
  <div>
    <el-table :data="shopOrderObj.records" style="width: 100%">
      <el-table-column prop="id" label="订单号" width="180"/>
      <el-table-column prop="priceTotal" label="订单总价" width="180"/>
      <el-table-column prop="status" label="订单状态" width="180"/>
      <el-table-column prop="date" label="下单时间" width="180"/>
      <el-table-column label="订单详情">
        <template #default="scope">
          <el-button
              type="primary"
              @click="$router.push({name:'OrderDetail',query:{id:scope.row.id}})"
          >查看详情
          </el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
        v-model:currentPage="shopOrderObj.current"
        v-model:page-size="shopOrderObj.size"
        background
        layout="prev, pager, next, jumper"
        :total="shopOrderObj.total"
        @current-change="findByItem"
    />
    <el-button type="primary" @click="$router.push('/shopIndex')">返回首页</el-button>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      shopOrderObj: {},
    }
  },
  methods: {
    findByItem(pageNO) {
      axios.get("/project/order/findByItem", {params: {pageNO}}).then(resp => {
        this.shopOrderObj = resp.data;
      })
    }
  },
  created() {
    this.findByItem(1);
  }
}
</script>

<style scoped>

</style>